/*    */ package com.asiainfo.dacp.catalog.controller;
/*    */ 
/*    */ import com.asiainfo.dacp.jdbc.JdbcTemplate;
/*    */ import java.io.PrintStream;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.ui.Model;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.bind.annotation.ResponseBody;
/*    */ import org.springframework.web.context.request.WebRequest;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/catalog/data"})
/*    */ public class CatalogDataController
/*    */ {
/*    */   @RequestMapping(value={"/objs"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   @ResponseBody
/*    */   public List<Map<String, Object>> getObjs(WebRequest request, Model model)
/*    */   {
/* 22 */     String start = request.getParameter("start");
/* 23 */     String limit = request.getParameter("limit");
/* 24 */     StringBuffer _where = new StringBuffer();
/* 25 */     if ((limit != null) && (!"".equals(limit))) {
/* 26 */       _where.append(" limit ");
/* 27 */       if ((start != null) && (!"".equals(start))) {
/* 28 */         _where.append(start + " , ");
/*    */       }
/* 30 */       _where.append(limit);
/*    */     }
/* 32 */     JdbcTemplate jdbc = new JdbcTemplate();
/* 33 */     List<Map<String, Object>> data = jdbc.queryForList("select * from tablefile" + _where);
/* 34 */     return data;
/*    */   }
/*    */   
/*    */   @RequestMapping(value={"/tablefile"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   @ResponseBody
/*    */   public List<Map<String, Object>> serachObjs(WebRequest request, Model model) {
/* 40 */     StringBuffer _where = new StringBuffer();
/* 41 */     String dataname = request.getParameter("DATANAME");
/* 42 */     String level_val = request.getParameter("LEVEL_VAL");
/* 43 */     String cycletype = request.getParameter("CYCLETYPE");
/* 44 */     String dbname = request.getParameter("DBNAME");
/* 45 */     String topicname = request.getParameter("TOPICNAME");
/*    */     
/* 47 */     String datanameCondition = "DATANAME like '%" + dataname + "%'";
/* 48 */     String dbnameCondition = "DBNAME='" + dbname + "'";
/* 49 */     String levelValCondition = "LEVEL_VAL='" + level_val + "'";
/* 50 */     String cycletypeCondition = "CYCLETYPE='" + cycletype + "'";
/* 51 */     String topicnameCondition = "TOPICNAME='" + topicname + "'";
/* 52 */     String condition = datanameCondition + "&&" + dbnameCondition + "&&" + levelValCondition + "&&" + cycletypeCondition + "&&" + topicnameCondition;
/* 53 */     System.out.println(condition);
/* 54 */     JdbcTemplate jdbc = new JdbcTemplate();
/* 55 */     List<Map<String, Object>> data = jdbc.queryForList("select * from tablefile where " + condition);
/* 56 */     return data;
/*    */   }
/*    */   
/*    */   @RequestMapping(value={"/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   @ResponseBody
/* 61 */   public Map getObj(WebRequest request, Model model, @PathVariable String id) { JdbcTemplate jdbc = new JdbcTemplate();
/* 62 */     Map data = jdbc.queryForMap("select * from meta_obj where xmlid='" + id + "'");
/* 63 */     List<Map<String, Object>> fields = jdbc.queryForList("select * from meta_field where xmlid='" + id + "'");
/* 64 */     data.put("fields", fields);
/* 65 */     return data;
/*    */   }
/*    */   
/*    */   @RequestMapping(value={"/acts"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   @ResponseBody
/* 70 */   public List<Map<String, Object>> getActs(WebRequest request, Model model) { String objtype = request.getParameter("objtype");
/* 71 */     JdbcTemplate jdbc = new JdbcTemplate();
/* 72 */     List<Map<String, Object>> data = jdbc.queryForList("select * from metasoft_action where refmodel='" + objtype + "'");
/* 73 */     return data;
/*    */   }
/*    */ }


/* Location:              C:\Users\my\.m2\repository\com\asiainfo\dacp\dacp-dataos\1.0.0\dacp-dataos-1.0.0.jar!\com\asiainfo\dacp\catalog\controller\CatalogDataController.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */